<template>
  <el-container>
    <el-header>
      <Header/>
    </el-header>
    <el-divider></el-divider>
    <div style="align-self: center">
      <el-input style="width:200px" placeholder="请输入场次序号" suffix-icon="el-icon-search"></el-input>
      <el-input style="width:200px" placeholder="请输入影厅序号" suffix-icon="el-icon-search"></el-input>
      <el-input style="width:200px" placeholder="请输入影片序号" suffix-icon="el-icon-search"></el-input>
      <el-button @click="search" class="ml-5" type="primary">搜索</el-button>
      <el-button type="warning" @click="reset">重置</el-button>
      <el-button type="warning" @click="dialoginsertVisible=true">增加</el-button>
    </div>
    <el-divider></el-divider>
    <el-table style="margin: auto"
              border
              stripe
              :data="tableData"
              :header-cell-style="headStyle"
    >
      <el-table-column prop="scheduleId" label="场次序号" width="50">
      </el-table-column>
      <el-table-column prop="roomId" label="影厅序号" width="100">
      </el-table-column>
      <el-table-column prop="movieId" label="影片序号" width="100">
      </el-table-column>
      <el-table-column prop="startTime" label="开始时间" width="200">
      </el-table-column>
      <el-table-column prop="endTime" label="结束时间" width="200">
      </el-table-column>
      <el-table-column prop="adminId" label="工号" width="200">
      </el-table-column>
      <el-table-column prop="creationTime" label="添加时间" width="200">
      </el-table-column>
      <el-table-column prop="lastmodTime" label="最后修改时间" width="300">
      </el-table-column>
      <el-table-column prop="remarks" label="操作">
        <template slot-scope="scope">
          <el-button type="primary" @click="edit(scope.row);dialogeditVisible=true">修改</el-button>
          <el-button type="danger">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div  style="padding:10px 0">
      <el-pagination
          :current-page="currentPage"
          :page-sizes="[5, 7, 10, 12]"
          :page-size="pagesize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="tableData.length">
          style="margin-left: 300px">
      </el-pagination>
    </div>
    <el-dialog title="添加场次" :visible.sync="dialoginsertVisible">
      <el-form :model="movie">
        <el-form-item label="影厅序号">
          <el-input v-model="movie.hall" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="影片序号">
          <el-input v-model="movie.mov" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="开始时间">
          <el-col :span="5">
            <el-date-picker type="date" placeholder="选择日期" v-model="movie.start1" style="width: 100%;"></el-date-picker>
          </el-col>
          <el-col class="line" :span="2">----------</el-col>
          <el-col :span="5">
            <el-time-picker placeholder="选择时间" v-model="movie.start2" style="width: 100%;"></el-time-picker>
          </el-col>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-col :span="5">
            <el-date-picker type="date" placeholder="选择日期" v-model="movie.end1" style="width: 100%;"></el-date-picker>
          </el-col>
          <el-col class="line" :span="2">----------</el-col>
          <el-col :span="5">
            <el-time-picker placeholder="选择时间" v-model="movie.end2" style="width: 100%;"></el-time-picker>
          </el-col>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialoginsertVisible = false">取消</el-button>
        <el-button type="primary" @click="dialoginsertVisible = false ;">确认</el-button>
      </div>
    </el-dialog>
    <el-dialog title="修改场次" :visible.sync="dialogeditVisible">
      <el-form :model="moviee">
        <el-form-item label="影厅序号">
          <el-input v-model="moviee.hall" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="影片序号">
          <el-input v-model="moviee.mov" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="开始时间">
          <el-input v-model="moviee.startTime" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-input v-model="moviee.endTime" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogeditVisible = false">取消</el-button>
        <el-button type="primary" @click="dialogeditVisible = false ;">确认</el-button>
      </div>
    </el-dialog>
  </el-container>
</template>

<script>
import Header from "@/components/Header";
export default {
  name: "timelinemana",
  components: {Header},
  data(){
    return{
      dialoginsertVisible: false,
      dialogeditVisible:false,
      tableData:[],
      pagesize:5,
      currentPage:1,
      movie:{
        hall:'',
        mov:'',
        start1:'',//日期
        start2:'',//时间
        end1:'',
        end2:'',
      },
      moviee:{
        hall:'',
        mov:'',
        startTime:'',
        endTime:'',
      }
    }
  },
  methods:{
    changNo(){
      this.$forceUpdate(0)
    },
    headStyle(){
      return "text-align:center"
    },
    edit(rowdata){
      this.moviee.endTime=rowdata.endTime;
      this.moviee.startTime=rowdata.startTime;
      this.moviee.mov=rowdata.movieId;
      this.moviee.hall=rowdata.roomId;
    }
  }
}
</script>

<style scoped>

</style>